<template>
	<view class="money-record">
		<view class="list-c" v-for="(item,index) of lists" :key="index">
			<view class="list">
				<view class="list-left">
					<text>
						{{moneyType(item.type)}}
						<span v-if="item.w_status === 1">（审核中）</span>
						<span style="color: #28cd8e;" v-if="item.w_status === 2">（提现成功）</span>
						<span style="color: red;" v-if="item.w_status === 3">（提现失败）</span>
					</text>
					<text>{{formatDate(item.create_time*1000)}}</text>
				</view>
				<view class="list-right">
					<text :class="item.status===1?'add':'reduce'">{{item.status===1?'+':'-'}}{{item.money}}</text>
				</view>
			</view>
			<span class="w_remarks" v-if="item.w_status === 3">备注：{{item.w_remarks}}</span>
		</view>
		<block-loading :status="status" :len="lists.length"></block-loading>
	</view>
</template>

<script>
	import {getMoney} from "@/api/entrance.js"
	import {moneyType,formatDate} from "@/utils/util.js"
	export default{
		name:"money-record",
		data(){
			return{
				page:1,
				lists:[],
				status:"loading"
			}
		},
		onLoad() {
			this.getLists();
		},
		onReachBottom(){
			this.getLists();
		},
		methods:{
			formatDate(val){
				return formatDate(val)
			},
			moneyType(val){
				return moneyType(val)
			},
			async getLists(){
				let res = await getMoney({page:this.page,size:20});
				if(res.code === 1){
					if(this.page===1&&res.data.length === 0){
						this.status = "nodata"
						return
					}
					if(this.page===1&&res.data.length > 0 && res.data.length < 20){
						this.status = "nomore"
					}
					if(res.data.length === 0){
						this.status = "nomore"
						return;
					}
					this.page++;
					this.lists = this.lists.concat(res.data);
				}
			},
		}
	}
</script>

<style lang="less" scoped src="./money-record.less">
</style>
